package com.example.mall.goods.api.service;


import com.example.mall.goods.api.dto.SaveOrderDTO;
import com.example.mall.goods.api.entity.MallOrder;
import com.example.mall.goods.api.vo.MallOrderDetailVO;
import com.example.mall.goods.api.vo.MallOrderItemVO;
import com.example.mall.util.PageQueryUtil;
import com.example.mall.util.PageResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "mall-goods-core")
public interface ShopOrderService {

    @PostMapping("/shopGoods/getShopOrdersPage")
    PageResult getShopOrdersPage(@RequestBody PageQueryUtil pageUtil);

    @PostMapping("/shopGoods/updateOrderInfo")
    String updateOrderInfo(@RequestBody MallOrder mallOrder);

    @PostMapping("/shopGoods/checkDone")
    String checkDone(@RequestParam("ids") Long[] ids);

    @PostMapping("/shopGoods/checkOut")
    String checkOut(@RequestParam("ids") Long[] ids);

    @PostMapping("/shopGoods/closeOrder")
    String closeOrder(@RequestParam("ids") Long[] ids);

    @PostMapping("/shopGoods/saveOrder")
    List<String> saveOrder(@RequestBody SaveOrderDTO saveOrderDTO);

    @PostMapping("/shopGoods/getOrderDetailByOrderNo")
    MallOrderDetailVO getOrderDetailByOrderNo(@RequestParam("orderNo") String orderNo,
                                              @RequestParam("userId") Long userId);

    @PostMapping("/shopGoods/getShopOrderByOrderNo")
    MallOrder getShopOrderByOrderNo(@RequestParam("orderNo") String orderNo);

    @PostMapping("/shopGoods/getMyOrders")
    PageResult getMyOrders(@RequestBody PageQueryUtil pageUtil);


    @PostMapping("/shopGoods/cancelOrder")
    String cancelOrder(@RequestParam("orderNo") String orderNo,
                       @RequestParam("userId") Long userId);

    @PostMapping("/shopGoods/finishOrder")
    String finishOrder(@RequestParam("orderNo") String orderNo,
                       @RequestParam("userId") Long userId);

    @PostMapping("/shopGoods/paySuccess")
    String paySuccess(@RequestParam("orderNo") String orderNo, @RequestParam("payType") int payType);

    @PostMapping("/shopGoods/getOrderItems")
    List<MallOrderItemVO> getOrderItems(@RequestParam("id") Long id);

}
